package com.redteam.data.beans;

import com.redteam.interfaces.Customer;
import java.io.Serializable;
import java.sql.Date;

/**
 * A java bean for customer pilot
 * @author Teddy Karam
 * @author Anthony Ferrari
 */
public class CustomerPilot extends Pilot implements Customer, Serializable {

    private HouseAccount account;
    private static final long serialVersionUID = 1L;


    /**
     * CustomerPilot full constructor
     * @param id
     * @param firstName
     * @param middleName
     * @param lastName
     * @param street
     * @param city
     * @param state
     * @param zipCode
     * @param email
     * @param fBOId
     * @param birthdate
     * @param homePhone
     * @param cellPhone
     * @param workPhone
     * @param gender
     * @param flightHours
     * @param endorse
     * @param type
     * @param userName
     * @param password
     */
    public CustomerPilot(long id, String firstName, String middleName, String lastName, String street, String city, String state, String zipCode,
            String email, long fBOId, Date birthdate, String homePhone, String cellPhone, String workPhone, String gender, int flightHours, String type, String userName, String password) {
        super(id, firstName, middleName, lastName, street, city, state, zipCode, email, fBOId, birthdate, homePhone, cellPhone, workPhone, gender, flightHours, type, userName, password);
        account = new HouseAccount();
    }

    /**
     * Default constructor
     */
    public CustomerPilot() {
        super();
        account = new HouseAccount();
    }

    /**
     * @inheritDoc
     */
    @Override
    public HouseAccount getHouseAccount() {
        return account;
    }

    /**
     * @inheritDoc
     */
    @Override
    public void setHouseAccount(HouseAccount account) {
        this.account = account;
    }

    /**
     * @inheritDoc
     */
    @Override
    public double makePayment(Payment payment) {
        double balance = account.getBalance() - payment.getPaymentAmount();
        account.setBalance(balance);
        return account.getBalance();
    }

    /**
     * @inheritDoc
     */
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final CustomerPilot other = (CustomerPilot) obj;
        if (this.account != other.account && (this.account == null || !this.account.equals(other.account))) {
            return false;
        }
        return true;
    }

    /**
     * @inheritDoc
     */
    @Override
    public int hashCode() {
        int hash = 5;
        hash = 13 * hash + (this.account != null ? this.account.hashCode() : 0);
        return hash;
    }
}
